// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIFrameLoader.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    ///This Source Code Form is subject to the terms of the Mozilla Public
    /// License, v. 2.0. If a copy of the MPL was not distributed with this
    /// file, You can obtain one at http://mozilla.org/MPL/2.0/. </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("1645af04-1bc7-4363-8f2c-eb9679220ab1")]
	public interface nsIFrameLoader
	{
		
		/// <summary>
        /// Get the docshell from the frame loader.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDocShell GetDocShellAttribute();
		
		/// <summary>
        /// Get this frame loader's TabParent, if it has a remote frame.  Otherwise,
        /// returns null.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsITabParent GetTabParentAttribute();
		
		/// <summary>
        /// Get an nsILoadContext for the top-level docshell. For remote
        /// frames, a shim is returned that contains private browsing and app
        /// information.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsILoadContext GetLoadContextAttribute();
		
		/// <summary>
        /// Start loading the frame. This method figures out what to load
        /// from the owner content in the frame loader.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void LoadFrame();
		
		/// <summary>
        /// Loads the specified URI in this frame. Behaves identically to loadFrame,
        /// except that this method allows specifying the URI to load.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void LoadURI([MarshalAs(UnmanagedType.Interface)] nsIURI aURI);
		
		/// <summary>
        /// Loads the specified URI in this frame but using a different process.
        /// Behaves identically to loadURI, except that this method only works
        /// with remote frame. For a signed package, we need to specifiy the
        /// package identifier.
        /// Throws an exception with non-remote frames.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SwitchProcessAndLoadURI([MarshalAs(UnmanagedType.Interface)] nsIURI aURI, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase aPackageId);
		
		/// <summary>
        /// Puts the frameloader in prerendering mode.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetIsPrerendered();
		
		/// <summary>
        /// Destroy the frame loader and everything inside it. This will
        /// clear the weak owner content reference.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Destroy();
		
		/// <summary>
        /// Find out whether the loader's frame is at too great a depth in
        /// the frame tree.  This can be used to decide what operations may
        /// or may not be allowed on the loader's docshell.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetDepthTooGreatAttribute();
		
		/// <summary>
        /// Updates the position and size of the subdocument loaded by this frameloader.
        ///
        /// @param aIFrame The nsIFrame for the content node that owns this frameloader
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void UpdatePositionAndSize(System.IntPtr aIFrame);
		
		/// <summary>
        /// Activate remote frame.
        /// Throws an exception with non-remote frames.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ActivateRemoteFrame();
		
		/// <summary>
        /// Deactivate remote frame.
        /// Throws an exception with non-remote frames.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void DeactivateRemoteFrame();
		
		/// <summary>
        /// @see nsIDOMWindowUtils sendMouseEvent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SendCrossProcessMouseEvent([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aType, float aX, float aY, int aButton, int aClickCount, int aModifiers, [MarshalAs(UnmanagedType.U1)] bool aIgnoreRootScrollFrame);
		
		/// <summary>
        /// Activate event forwarding from client (remote frame) to parent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ActivateFrameEvent([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aType, [MarshalAs(UnmanagedType.U1)] bool capture);
		
		/// <summary>
        /// Note, when frameloaders are swapped, also messageManagers are swapped.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIMessageSender GetMessageManagerAttribute();
		
		/// <summary>
        /// @see nsIDOMWindowUtils sendKeyEvent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SendCrossProcessKeyEvent([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aType, int aKeyCode, int aCharCode, int aModifiers, [MarshalAs(UnmanagedType.U1)] bool aPreventDefault);
		
		/// <summary>
        /// Request that the next time a remote layer transaction has been
        /// received by the Compositor, a MozAfterRemoteFrame event be sent
        /// to the window.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void RequestNotifyAfterRemotePaint();
		
		/// <summary>
        /// Request an event when the layer tree from the remote tab becomes
        /// available or unavailable. When this happens, a mozLayerTreeReady
        /// or mozLayerTreeCleared event is fired.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void RequestNotifyLayerTreeReady();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void RequestNotifyLayerTreeCleared();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetEventModeAttribute();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetEventModeAttribute(uint aEventMode);
		
		/// <summary>
        /// If false, then the subdocument is not clipped to its CSS viewport, and the
        /// subdocument's viewport scrollbar(s) are not rendered.
        /// Defaults to true.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetClipSubdocumentAttribute();
		
		/// <summary>
        /// If false, then the subdocument is not clipped to its CSS viewport, and the
        /// subdocument's viewport scrollbar(s) are not rendered.
        /// Defaults to true.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetClipSubdocumentAttribute([MarshalAs(UnmanagedType.U1)] bool aClipSubdocument);
		
		/// <summary>
        /// If false, then the subdocument's scroll coordinates will not be clamped
        /// to their scroll boundaries.
        /// Defaults to true.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetClampScrollPositionAttribute();
		
		/// <summary>
        /// If false, then the subdocument's scroll coordinates will not be clamped
        /// to their scroll boundaries.
        /// Defaults to true.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetClampScrollPositionAttribute([MarshalAs(UnmanagedType.U1)] bool aClampScrollPosition);
		
		/// <summary>
        /// The element which owns this frame loader.
        ///
        /// For example, if this is a frame loader for an <iframe>, this attribute
        /// returns the iframe element.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMElement GetOwnerElementAttribute();
		
		/// <summary>
        /// Cached childID of the ContentParent owning the TabParent in this frame
        /// loader. This can be used to obtain the childID after the TabParent died.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		ulong GetChildIDAttribute();
		
		/// <summary>
        /// Get or set this frame loader's visibility.
        ///
        /// The notion of "visibility" here is separate from the notion of a
        /// window/docshell's visibility.  This field is mostly here so that we can
        /// have a notion of visibility in the parent process when frames are OOP.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetVisibleAttribute();
		
		/// <summary>
        /// Get or set this frame loader's visibility.
        ///
        /// The notion of "visibility" here is separate from the notion of a
        /// window/docshell's visibility.  This field is mostly here so that we can
        /// have a notion of visibility in the parent process when frames are OOP.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetVisibleAttribute([MarshalAs(UnmanagedType.U1)] bool aVisible);
		
		/// <summary>
        /// Find out whether the owner content really is a browser or app frame
        /// Especially, a widget frame is regarded as an app frame.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetOwnerIsBrowserOrAppFrameAttribute();
		
		/// <summary>
        /// Find out whether the owner content really is a widget. If this attribute
        /// returns true, |ownerIsBrowserOrAppFrame| must return true.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetOwnerIsWidgetAttribute();
	}
	
	/// <summary>nsIFrameLoaderConsts </summary>
	public class nsIFrameLoaderConsts
	{
		
		// <summary>
        // The default event mode automatically forwards the events
        // handled in EventStateManager::HandleCrossProcessEvent to
        // the child content process when these events are targeted to
        // the remote browser element.
        //
        // Used primarly for input events (mouse, keyboard)
        // </summary>
		public const ulong EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
		
		// <summary>
        // With this event mode, it's the application's responsability to
        // convert and forward events to the content process
        // </summary>
		public const ulong EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
	}
	
	/// <summary>nsIFrameLoaderOwner </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("c4abebcf-55f3-47d4-af15-151311971255")]
	public interface nsIFrameLoaderOwner
	{
		
		/// <summary>
        /// The frame loader owned by this nsIFrameLoaderOwner
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		System.IntPtr GetFrameLoaderAttribute();
		
		/// <summary>Member GetFrameLoader </summary>
		/// <returns>A System.IntPtr</returns>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		System.IntPtr GetFrameLoader();
		
		/// <summary>
        /// Puts the FrameLoaderOwner in prerendering mode.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetIsPrerendered();
		
		/// <summary>
        /// Swap frame loaders with the given nsIFrameLoaderOwner.  This may
        /// only be posible in a very limited range of circumstances, or
        /// never, depending on the object implementing this interface.
        ///
        /// @throws NS_ERROR_NOT_IMPLEMENTED if the swapping logic is not
        /// implemented for the two given frame loader owners.
        /// @throws NS_ERROR_DOM_SECURITY_ERR if the swap is not allowed on
        /// security grounds.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SwapFrameLoaders(System.IntPtr aOtherOwner);
	}
}
